//
//  XDMyAchieveTableViewCell.m
//  xindailianmeng
//
//  Created by 张东 on 2017/2/21.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDMyAchieveTableViewCell.h"
#import "XDMyAchieveModel.h"
@interface XDMyAchieveTableViewCell ()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *realNameConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mobileConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *timeConstraint;


@property (weak, nonatomic) IBOutlet UILabel *rownoLb;
@property (weak, nonatomic) IBOutlet UILabel *realNameLb;

@property (weak, nonatomic) IBOutlet UILabel *mobileLb;

@property (weak, nonatomic) IBOutlet UILabel *ctimeLb;

@property (weak, nonatomic) IBOutlet UILabel *investCountLb;

@end

@implementation XDMyAchieveTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self = [[NSBundle mainBundle] loadNibNamed:@"XDMyAchieveTableViewCell" owner:self options:nil].firstObject;
        
        
    }
    return self;
}


- (void)setModel:(XDMyAchieveModel *)model {
    
    _model = model;
    //    "rowno":1,                    int 序号
    self.rownoLb.text = [NSString stringWithFormat:@"%zd",model.rowno];
    //    "ctime":1483942353000,           String 注册时间
    
    self.ctimeLb.text = model.inTime;
    //    "uid":11,                          （Long 用户id忽略)
    //    "investCount":0,                   int 是否投资见说明（investCount:显示的是这个用户投资的数量，未0时为未投资反之已投资）
    
//    if (model.investCount == 0) {
//        self.investCountLb.text = @"未投资";
//        self.investCountLb.textColor = kColorRGB(187,147,115);
//    } else {
//        
        self.investCountLb.text = [NSString stringWithFormat:@"%.2f >",model.yMoney];

    //    "mobile":"15600803605",          String 手机号
    self.mobileLb.text = model.mobile;
    //    "realName":"赵润虹"               String 客户名（如果没有实名认证，此可以没有）
    if (model.realName) {
        
//        self.realNameLb.text = [model.realName stringByReplacingCharactersInRange:NSMakeRange(1, model.realName.length - 1) withString:@"*"];
        self.realNameLb.text = model.realName;
    } else {
        self.realNameLb.text = @"*";
    }
}


- (void)layoutSubviews {
    
    self.realNameConstraint.constant = 58 * kscaleW;
    
    self.mobileConstraint.constant = 180 * kscaleW;
    
    self.timeConstraint.constant = 90 * kscaleW;
    
    [self updateConstraintsIfNeeded];
}

@end
